package springboot.service.impl;

import org.springframework.stereotype.Service;
import springboot.dao.WxDepartmentDao;
import springboot.doMain.WxDepartment;
import springboot.service.WxDepartmentService;

import java.util.List;

@Service
public class WxDepartmentServiceImpl implements WxDepartmentService {
	
	final
	WxDepartmentDao wxDepartmentDao;
	
	public WxDepartmentServiceImpl(WxDepartmentDao wxDepartmentDao) {
		this.wxDepartmentDao = wxDepartmentDao;
	}
	
	@Override
	public List<WxDepartment> selAllDepartment() {
		return wxDepartmentDao.selAllDepartment();
	}
	
	@Override
	public int insertDepartment(WxDepartment wxDepartment) {
		WxDepartment selDepartment = selDepartment(wxDepartment);
		if (selDepartment != null) {
			return 0;
		}
		return wxDepartmentDao.insertDepartment(wxDepartment);
	}
	
	@Override
	public int updateDepartment(WxDepartment wxDepartment) {
		return wxDepartmentDao.updateDepartment(wxDepartment);
	}
	
	@Override
	public WxDepartment selDepartment(WxDepartment wxDepartment) {
		return wxDepartmentDao.selDepartment(wxDepartment);
	}
}
